<?php
namespace app\manager\controller;
use think\Controller;
use think\Request;
use Nette\Mail\Message;
use Nette\Mail\SendmailMailer;
class Index extends BaseController
{
    /**
     * 首页面
     * @return [type] [description]
     */
    public function index()
    {
        if (model('CampManagers')->checkLogin()) {
            $user_id = session('manager.id');
            $camp_id = model('CampManagers')->where('id',$user_id)->value('camp_id');
            $order_count = count(model('Orders')->getOrders(['camp_id' => $camp_id]));
            $this->assign('order_count',$order_count);
            $user_count = count(model('Users')->getUserList());
            $this->assign('user_count',$user_count);
            $camp_name = model('Camps')->where('id',$camp_id)->value('name');
            $this->assign('camp_name',$camp_name);
            $caravan_count = count(model('Caravans')->getCaravansLists());
            $this->assign('caravan_count',$caravan_count);
            return view('index');
        }else{
            $this->redirect('@campmanager/login');
        }
    }

    
}

